﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Hxsoft.AppV1.Module;

namespace Hxsoft.AppV1.WebUI
{
	/// <summary>
	/// 文章摘要列表。
	/// </summary>
	public class ArticleSummaryList : ArticleList
	{
		/// <summary>
		/// 列表项的摘要内容。
		/// </summary>
		public virtual string ItemSummary
		{
			get
			{
				return Eval("Summary", null);
			}
		}

		/// <summary>
		/// 获取列表数据。
		/// </summary>
		/// <returns></returns>
		public override object GetListData()
		{
			if (!string.IsNullOrEmpty(AttachedModuleCodes))
			{
				List<string> moduleCodes = new List<string>();
				if (!string.IsNullOrEmpty(ModuleCode)) moduleCodes.Add(ModuleCode);
				moduleCodes.AddRange(AttachedModuleCodes.Split(ModuleCodeSeparator, StringSplitOptions.RemoveEmptyEntries));
				return Articles.GetSummaryList(SiteId, moduleCodes.ToArray(), Keyword, LoadCount);
			}

			int? moduleId = null;
			if (!string.IsNullOrEmpty(ModuleCode))
				moduleId = ModuleId.Value;
			return Articles.GetSummaryList(SiteId, moduleId, Keyword, LoadCount);
		}
	}
}